package com.wm.blog_common.enums;

/***
 * @ClassName: DeleteFlag
 * @Description:
 * @Author: 半卷流年
 * @Create_time: 14:03 2020-3-17
 */

import lombok.AllArgsConstructor;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/***
 * @ClassName: CommentFlag  评论类型枚举
 * @Author: 半卷流年
 * @Create_time: 14:45 2019-12-17
 */
@AllArgsConstructor
public enum CommentFlag {

    /**
     *
     */
    COMMENT(0,"评论"),
    LIKE(1,"点赞")
    ;

    private Integer value;

    private String text;

    public Integer getValue() {
        return value;
    }

    public String getText() {
        return text;
    }

    public static String getText(Integer value){
        List<String> list = Arrays.stream(CommentFlag.values()).filter(x -> !ObjectUtils.isEmpty(x) && x.value.equals(value)).map(y -> y.text).collect(Collectors.toList());
        return CollectionUtils.isEmpty(list) ? "":list.get(0);
    }
}
